package flink_p1

import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment, createTypeInformation}

object FlinkTest_04_fromCollection {


  def main(args: Array[String]): Unit = {


    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

    val dstream: DataStream[String] = env.fromCollection(List("hello", "java c++ c go", "scala", "hadoop"))

    val ds1: DataStream[(String, Int)] = dstream.flatMap(_.split(" ")).map((_, 1)).keyBy(0).sum(1)
    ds1.print()

    env.execute("test")

  }
}
